<template>
  <div class="c-bg-sgray c-pt20 c-p">
    <!-- <my-small-tabbar :tabList="tabList" :tabIndex="tabIndex" :flexClass="'c-justify-sa'" :isScroll="true" @changeTab="changeType" class="c-ph24"></my-small-tabbar> -->
    <pay-password v-show="showPasswordModal" @hidePwd='hidePwd' @confirmPwd='confirmPwd'></pay-password>
    <template>
      <div class="c-ph24 c-fs22">
        <div class="c-br10 c-bg-white c-pt8 c-pb32">
          <div class="c-fs22 c-pv24 c-ph20" :class="isDistribution ? '':'c-bd-b1'" v-if="allBalance">账户余额(元): {{allBalance}}</div>
          <div class="c-flex-row c-w100 c-contexty-hidden c-contextX-scroll c-ws-n c-pl20" v-if="isDistribution && formUserType == -1 && userInfo">
            <div v-if="showSpreadType().isShow" @click="changeWithdrawType('SPREAD')" class="c-ww200 c-hh114 c-pv20 c-br10 c-mr20 c-p c-textAlign-c c-flex-shrink0" :class="[withdrawType == 'SPREAD' ? 'theme-bd1 theme-fc' : 'c-fc-xblack c-bd1-mgray']">
              <p>知识收入(元)</p>
              <p class="c-pt10 c-fs28 c-fw-b">{{userInfo.balance ? Number(userInfo.balance).toFixed(2) : '0.00'}}</p>
              <div class="c-pa p-bmp8 p-rmp5 iconfont theme-fc" v-if="withdrawType == 'SPREAD'">&#xe9b3;</div>
            </div>
            <div v-if="showChannelType().isShow" @click="changeWithdrawType('CHANNEL')" class="c-ww200 c-hh114 c-pv20 c-br10 c-mr20 c-p c-textAlign-c c-flex-shrink0" :class="[withdrawType == 'CHANNEL' ? 'theme-bd1 theme-fc' : 'c-fc-xblack c-bd1-mgray']">
              <p>视频号收入(元)</p>
              <p class="c-pt10 c-fs28 c-fw-b">{{userInfo.mallWxBalance ? Number(userInfo.mallWxBalance).toFixed(2) : '0.00'}}</p>
              <div class="c-pa p-bmp8 p-rmp5 iconfont theme-fc" v-if="withdrawType == 'CHANNEL'">&#xe9b3;</div>
            </div>
            <div v-if="showDistributionType().isShow" @click="changeWithdrawType('DISTRIBUTION')" class="c-ww200 c-hh114 c-pv20 c-br10 c-mr20 c-p c-textAlign-c c-flex-shrink0" :class="[withdrawType == 'DISTRIBUTION' ? 'theme-bd1 theme-fc' : 'c-fc-xblack c-bd1-mgray']">
              <p>推广收入(元)</p>
              <p class="c-pt10 c-fs28 c-fw-b">{{userInfo.distributionBalance ? Number(userInfo.distributionBalance).toFixed(2) : '0.00'}}</p>
              <div class="c-pa p-bmp8 p-rmp5 iconfont theme-fc" v-if="withdrawType == 'DISTRIBUTION'">&#xe9b3;</div>
            </div>
            <div v-if="showShareholderType().isShow" @click="changeWithdrawType('SHAREHOLDER')" class="c-ww200 c-hh114 c-pv20 c-br10 c-mr20 c-p c-textAlign-c c-flex-shrink0" :class="[withdrawType == 'SHAREHOLDER' ? 'theme-bd1 theme-fc' : 'c-fc-xblack c-bd1-mgray']">
              <p>股东收益(元)</p>
              <p class="c-pt10 c-fs28 c-fw-b">{{userInfo.sBalance ? Number(userInfo.sBalance).toFixed(2) : '0.00'}}</p>
              <div class="c-pa p-bmp8 p-rmp5 iconfont theme-fc" v-if="withdrawType == 'SHAREHOLDER'">&#xe9b3;</div>
            </div>
            <div v-if="showChainType().isShow" @click="changeWithdrawType('CHAIN')" class="c-ww200 c-hh114 c-pv20 c-br10 c-mr20 c-p c-textAlign-c c-flex-shrink0" :class="[withdrawType == 'CHAIN' ? 'theme-bd1 theme-fc' : 'c-fc-xblack c-bd1-mgray']">
              <p>分红收益(元)</p>
              <p class="c-pt10 c-fs28 c-fw-b">{{userInfo.bonusBalance ? Number(userInfo.bonusBalance).toFixed(2) : '0.00'}}</p>
              <div class="c-pa p-bmp8 p-rmp5 iconfont theme-fc" v-if="withdrawType == 'CHAIN'">&#xe9b3;</div>
            </div>
          </div>
        </div>
      </div>
      <div @click="chooseWithdrawMethod" class="c-ph24 c-fs22 c-mt20">
        <div class="c-br10 c-bg-white c-ph20 c-pv32 c-flex-row c-aligni-center c-justify-sb">
          <div class="c-fs24 c-fc-xblack">选择提现方式</div>
          <div class="c-fs24 theme-fc">{{tabIndex == 1 ? '提现到银行卡' : tabIndex == 2 ? '提现到微信' : tabIndex == 3 ? '提现到支付宝' : ''}}<span class="iconfont c-fs18 theme-fc c-ml8">&#xe635;</span></div>
        </div>
      </div>
      <div class="c-ph24 c-fs22 c-mt20">
        <div class="c-br10 c-bg-white c-ph20 c-pt20 c-pb24">
          <div class="c-fs24 c-fc-xblack">提现金额</div>
          <div class="c-pv30 c-bd-b1 c-flex-row c-aligni-center c-justify-sb">
            <div class="c-flex-row c-aligni-center c-w0 c-flex-grow1">
              <span class="c-fs40">{{'￥' | iosPriceFilter}}</span>
              <input type="number" v-model="withdraw" @focus='inputFocus' @blur='inputBlur' placeholder="0.00" class="c-fs56 c-bd0 c-w0 c-flex-grow1 needsclick" :class="withdraw == null ? 'c-fc-sgray' : 'x-fc-xblack'"/>
            </div>
            <span class="c-fs22 c-pl16 theme-fc" @click="totalWithdraw">全部提现</span>
          </div>
          <div class="c-pt20 c-flex-row c-fc-gray" v-if="userInfo && userInfo.iosBalance && withdrawType != 'DISTRIBUTION'">
            <span>不可提现金额{{'￥' | iosPriceFilter}}{{Number(userInfo.iosBalance).toFixed(2)}},</span>
            <span class="theme-fc c-pl10" @click="showReason">查看原因</span>
          </div>
          <div class="c-pt20 c-fc-gray">
            <span>手续费{{(isUseSelfMchId || formUserType != -1) && withdrawType != 'DISTRIBUTION' ? ratio : 0.6}}%,</span>
            <span v-show="withdrawType == 'DISTRIBUTION'">结算周期为T+3。</span>
            <span>实际到账金额为{{'￥' | iosPriceFilter}}{{(isUseSelfMchId || formUserType != -1) && (withdrawType == 'SPREAD' || withdrawType == 'SHAREHOLDER') ? Number(Number(withdraw) - (withdraw * ratio/100 * 1).toFixed(2)).toFixed(2) : Number(Number(withdraw) - (withdraw * 0.6/100 * 1).toFixed(2)).toFixed(2)}}</span>
          </div>
          <div @click="showFormula = true" v-if="withdrawSettings && (withdrawSettings.isNeedInvoice == 1 || withdrawSettings.isNeedInvoice == 2) && taxAmount > 0" class="c-pt20 c-flex-row c-aligni-center c-justify-sb">
            <div class="c-fc-gray">
              <span>本次提现预计税额:{{'￥' | iosPriceFilter}}{{ taxAmount }}</span>
            </div>
            <div class="iconfont c-fs18 theme-fc">&#xe635;</div>
          </div>
        </div>
      </div>
      <div v-if="withdrawSettings && (withdrawSettings.isNeedInvoice == 1 || withdrawSettings.isNeedInvoice == 2)" class="c-pt20 c-ph24">
        <div class="c-flex-row c-flexw-wrap">
          <div v-for="(item, index) in invoiceList" :key="index" class="c-ww184 c-hh184 c-p img-item c-mb20">
            <img :src="$addXossFilter(item, require('@/assets/defult270.png'))" class="c-w100 c-h c-br8" />
            <div @click="deleteInvoiceItem(index)" class="c-pa iconfont c-p-t0 c-p-r0 c-fs36 c-fc-gray c-brp50 c-bg-white">&#xe757;</div>
          </div>
          <div v-if="invoiceList.length < 6" @click="tapUpload" class="c-ww184 c-hh184 c-bg-white c-flex-column c-flex-center c-br8 img-item c-mb20">
            <div class="theme-fc c-fs48 c-rotate45 iconfont">&#xe757;</div>
            <div class="c-fs24 c-fc-gray c-mt20">上传发票</div>
          </div>
        </div>
        <div class="c-fs24 theme-fc"><span @click="goInvoiceRule" class="c-fs20 c-text-decoration-underline">查看发票规则</span><span class="c-fs18 iconfont c-pl4">&#xe635;</span></div>
      </div>
      <div v-if="withdrawRateText" @click="showWithdrawRule = true" class="c-pf c-p-b140 c-p-r0 c-fs20 c-fw600 c-fc-white c-ww124 c-hh44 c-flex-row c-flex-center c-br-tl32 c-br-bl32 theme-bg">提现规则</div>
      <!-- <section v-if="withdrawRateText" class="c-fs20 c-fc-reword c-pt30 c-ph24 c-pb20 c-wb-ba c-ws-pw c-lh40">
        <div class="c-wb-ba">提现规则:</div>
        <div v-html="withdrawRateText"></div>
      </section> -->
      <div class="c-pf c-p-b0 c-w100 c-pz100 c-fs24 c-flex-row c-flex-center c-hh88 c-bg-white c-ph24 c-maxw640" @click="clickComfirm">
        <div class="c-hh64 c-br32 c-fc-white c-w100 c-flex-row c-flex-center c-fs24 " :class="withdraw == null || withdraw == 0 ? 'theme-bg-gradient c-opacity50' : 'theme-bg'">提现</div>
      </div>
    </template>
    <cj-popup v-model="showWithdrawRule" round position="bottom" :closeable="true" title="提现规则">
      <div class="c-fs20 c-fc-xblack c-pt24 c-ph24 c-pb80 c-wb-ba c-ws-pw c-lh40" v-html="withdrawRateText"></div>
    </cj-popup>
    <cj-popup v-model="showSubmitNamePopup" round class="submit-name-dialog c-w80">
      <div class="c-bg-white c-flex-column c-br20 c-fc-xblack">
        <div class="c-ph40 c-textAlign-c c-pb40 c-p">
          <div class="c-fs28 c-fw600 c-pt40 c-pb20">验证收款人姓名</div>
          <div class="c-fs22 c-lh36 c-pb10">微信规定，提现金额大于等于2000元，需实名认证。请填写本微信号实名认证的完整姓名，否则会打款失败。</div>
          <div :class="showInputError ? 'c-bd-b1-xxlred' : 'c-bd-b1-ccc'">
            <input @input="inpurEnter" @focus='inputFocus' @blur='inputBlur' id="inputName" type="text" v-model.trim="inputName" class="c-bd0 c-w100 c-hh70 c-fs28 c-textAlign-c" />
          </div>
          <div v-show="showInputError" class="c-fs18 c-fc-xxlred c-pa c-p-b10">请输入收款人姓名</div>
        </div>
        <div class="c-hh78 c-bd-t1 c-flex-row c-fs28">
          <div @click="closeSubmitNamePopup" class="c-flex-1 c-bd-r1 c-flex-row c-flex-center c-fc-gray">取消</div>
          <div @click="clickSubmitName" class="c-flex-1 c-flex-row c-flex-center theme-fc">确认</div>
        </div>
      </div>
    </cj-popup>
    <cj-popup v-model="showFormula" round position="bottom" class="c-p" :closeable="true" :title="'税额计算公式'">
      <div class="c-pt40 c-pb180 c-ph24 c-bg-sgray">
        <div class="c-fs24 c-fc-xblack">个人所得税预扣率表<span class="c-fs20 c-fc-gray">（居民个人劳务报酬所得预扣缴适用）</span></div>
        <div class="c-bg-white c-br12 c-text-hidden c-mt20">
          <div class="c-flex-row formula-list-bg">
            <div class="c-ww100 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">级数</div>
            <div class="c-w0 c-flex-grow1 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">预扣预缴应纳所得额</div>
            <div class="c-ww100 c-fs22 c-fc-xblack c-hh72 c-flex-row c-flex-center">预扣率</div>
          </div>
          <div class="c-flex-row c-bd-b1-f6">
            <div class="c-ww100 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">1</div>
            <div class="c-w0 c-flex-grow1 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">不超过20000元</div>
            <div class="c-ww100 c-fs22 c-fc-xblack c-hh72 c-flex-row c-flex-center">20%</div>
          </div>
          <div class="c-flex-row c-bd-b1-f6">
            <div class="c-ww100 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">2</div>
            <div class="c-w0 c-flex-grow1 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">超过20000元至50000元的部分</div>
            <div class="c-ww100 c-fs22 c-fc-xblack c-hh72 c-flex-row c-flex-center">30%</div>
          </div>
          <div class="c-flex-row">
            <div class="c-ww100 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">3</div>
            <div class="c-w0 c-flex-grow1 c-fs22 c-fc-xblack c-bd-r1-f6 c-hh72 c-flex-row c-flex-center">超过50000元的部分</div>
            <div class="c-ww100 c-fs22 c-fc-xblack c-hh72 c-flex-row c-flex-center">40%</div>
          </div>
        </div>
        <div class="c-fs20 c-fc-gray c-mt20">注：按月或按次申报纳税</div>
      </div>
      <div class="c-w100 c-pa c-p-b0 c-p-l0 c-hh88 c-bg-white c-flex-row c-flex-center c-ph30">
        <div @click="showFormula = false" class="c-fs22 c-fc-white theme-bg c-flex-row c-flex-center c-flex-grow1 c-hh64 c-br32">我知道了</div>
      </div>
    </cj-popup>
    <add-ali-account-com :showAddAliAccount="showAddAliAccount" :aliInfoDefault="aliPayInfo" @addAliPaySuccess="addAliPaySuccess" @closeDia="closeDia"></add-ali-account-com>
    <cj-popup v-model="showWithdrawMethod" round position="bottom" :closeable="true" title="选择提现方式" @close="closeWithdrawMethod">
      <div class="c-pb140 c-bg-sgray c-p">
        <template v-if="tabList && tabList.length">
          <my-small-tabbar :tabList="tabList" :tabIndex="tabTmp" :flexClass="tabList.length > 1 ? 'c-justify-sa' : 'c-justify-start'" :isScroll="true" @changeTab="changeType" class="c-ph24 c-bg-white"></my-small-tabbar>
          <div class="c-ph24 c-mt24">
            <div class="c-fs22 c-br10 c-bg-white c-pt20">
              <div v-if="tabTmp == 1" class="c-ph20">
                <div v-if="noneBank && !nonePwd">
                  <div class="c-flex-row c-aligni-center c-justify-sb c-bd-b1 c-pb20 c-lh40" @click="goAddBank">
                    <div class="c-flex-row c-aligni-center">
                      <img :src="require('@/assets/i/wap/bank/icon/bank.png')" class="c-ww40" />
                      <div class="c-pl20 c-fs24">到银行卡</div>
                    </div>
                    <div class="c-flex-row c-aligni-center theme-fc">去绑定<span class="iconfont theme-fc c-pl14 c-fs20">&#xe635;</span></div>
                  </div>
                </div>
                <div class="c-flex-row c-aligni-center c-justify-sb c-bd-b1 c-pb20 c-lh40" v-else>
                  <div class="c-flex-row c-aligni-center">
                    <img :src="require('../../../assets/i/wap/bank/icon/'+ userBank.bankCardId+'.png')" v-if="userBank" class="c-ww32 c-hh32" />
                    <div class="c-pl20 c-fs24">{{userBank.bankCardId == 19 && userBank.otherBankName ? userBank.otherBankName : BANK_NAME_MAP[userBank.bankCardId]}}</div>
                  </div>
                  <div class="c-flex-row c-aligni-center theme-fc" @click="goAddBank">修改<span class="iconfont theme-fc c-pl14 c-fs20">&#xe635;</span></div>
                </div>
                <div class="c-hh220 c-pt30">
                  <div v-if="!(noneBank && !nonePwd)" class="c-hh160 c-p">
                    <img :src="'https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/bank/' + this.userBank.bankCardId+'.png'" class="c-w100 c-block c-h c-br10" />
                    <span class="c-lh c-pa bnum c-fs28 c-fc-white">*****&nbsp;*****&nbsp;*****&nbsp;{{bankAccount}}</span>
                  </div>
                </div>
              </div>
              <div class="c-ph20" v-if="tabTmp == 2">
                <div class="c-flex-row c-aligni-center c-bd-b1 c-pb20 c-lh40">
                  <img :src="$addXossFilter(userHeadImg, require('../../../assets/defult_head.png'))" alt="" class="c-ww32 c-hh32 c-brp50">
                  <span class="c-pl10">{{userName}}</span>
                </div>
                <div class="c-hh220">
                  <div class="c-pt30 c-fs24 c-fc-xblack">提现到此微信号</div>
                </div>
              </div>
              <div v-if="tabTmp == 3" class="c-ph20">
                <div class="c-flex-row c-aligni-center c-justify-sb c-bd-b1 c-pb20 c-lh40">
                  <div class="c-flex-row c-aligni-center">
                    <div class="iconfont c-fs32 c-fc-smblue">&#xe74e;</div>
                    <div class="c-pl10 c-fs24">支付宝账号</div>
                  </div>
                  <div @click="popAliAccountModal" v-if="aliAccountEncry" class="c-flex-row c-aligni-center theme-fc">修改<span class="iconfont theme-fc c-pl14 c-fs20">&#xe635;</span></div>
                  <div @click="popAliAccountModal" v-else class="c-flex-row c-aligni-center theme-fc">去绑定<span class="iconfont theme-fc c-pl14 c-fs20">&#xe635;</span></div>
                </div>
                <div class="c-hh220 c-pt40">
                  <template v-if="aliAccountEncry">
                    <div class="c-fs24 c-fc-xblack">已绑定账号：</div>
                    <div class="c-fs32 c-fc-xblack c-fw600 c-mt12">{{ aliAccountEncry }}</div>
                  </template>
                </div>
              </div>
            </div>
          </div>
          <div class="c-pa c-p-b0 c-p-l0 c-w100 c-pz100 c-fs24 c-flex-row c-flex-center c-hh88 c-bg-white c-ph24 c-maxw640">
            <div @click="confirmWithdrawMethod" class="c-hh64 c-br32 c-fc-white c-w100 c-flex-row c-flex-center c-fs24 theme-bg">确定</div>
          </div>
        </template>
        <template v-else>
          <loading-status-tem :noData="true" :noDataText="'暂无提现方式，请联系管理员~'"></loading-status-tem>
        </template>
      </div>
    </cj-popup>
  </div>
</template>

<script>
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import PayPassword from "@/components/templates/common/pay/payPassword.vue";
import AddAliAccountCom from "@/components/templates/addAliAccountCom.vue";
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import { utilJs } from "@/utils/common.js"
let isClick = false;
let inputScrollTop = 0;
let enableBankWithdraw = "";
let enableWxWithdraw = "";
let enableAliPayWithdraw = "";
export default {
  name: 'Withdraw',
  components: {
    MySmallTabbar,
    PayPassword,
    AddAliAccountCom,
    loadingStatusTem
  },
  props: [],
  beforeCreate() {

  },
  created() {
    utilJs.appShare(this);
  },
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      vm.pathFrom = from.fullPath;
    });
  },
  computed: {
    taxAmount() {
      let taxA = 0;
      //到手金额（扣除手续费）
      let realAmount = (this.isUseSelfMchId || this.formUserType != -1) && (this.withdrawType == 'SPREAD' || this.withdrawType == 'SHAREHOLDER') ? Number(Number(this.withdraw) - (this.withdraw * this.ratio / 100 * 1).toFixed(2)).toFixed(2) : Number(Number(this.withdraw) - (this.withdraw * 0.6 / 100 * 1).toFixed(2)).toFixed(2)
      if (realAmount > 50000) {
        taxA = Number((realAmount - 50000) * 0.4 + 30000 * 0.3 + 20000 * 0.2).toFixed(2);
      } else if (realAmount > 20000) {
        taxA = Number((realAmount - 20000) * 0.3 + 20000 * 0.2).toFixed(2);
      } else {
        taxA = Number(realAmount * 0.2).toFixed(2);
      }
      return taxA;
    },
    // 计算属性的 getter
    allBalance: function () {
      // `this` 指向 vm 实例
      // if (this.formUserType != -1) {
      //   return (this.userInfo.balance * 1 + this.userInfo.sBalance * 1 + this.userInfo.bonusBalance * 1).toFixed(2);
      // } else {
      //   return (this.userInfo.balance * 1 + this.userInfo.distributionBalance * 1 + this.userInfo.sBalance * 1 + this.userInfo.bonusBalance * 1).toFixed(2);
      // }
      return (this.userInfo.balance * 1 + this.userInfo.distributionBalance * 1 + this.userInfo.sBalance * 1 + (this.isMallWx ? this.userInfo.mallWxBalance * 1 : 0) + (this.enableChainModel == 1 ? this.userInfo.bonusBalance * 1 : 0)).toFixed(2);
    }
  },
  data() {
    return {
      isFaShou: localStorage.getItem("isFaShou") == 1,
      theme: localStorage.getItem("colorName") || 'mb5_default',
      from: '',
      isDistribution: 0, //是否分销商城
      withdrawType: 'SPREAD', //提现类型
      BANK_NAME_MAP: {
        1: '工商银行',
        2: '建设银行',
        3: '华夏银行',
        4: '中国银行',
        5: '中国邮政储蓄银行',
        6: '交通银行',
        7: '民生银行',
        8: '招商银行',
        9: '农业银行',
        10: '北京银行',
        11: '兴业银行',
        12: '上海银行',
        13: '中国光大银行',
        14: '上海浦东发展银行',
        15: '中信银行',
        16: '广发银行',
        17: '平安银行',
        18: '汇丰银行',
        19: '其他银行'
      },
      noneBank: true, // 没银行卡信息
      nonePwd: false, // 没有支付密码,提现无需支付密码
      bankAccount: '', // 银行卡后四位
      userBank: '', // 用户绑定银行卡信息
      userInfo: null, // 用户信息
      withdraw: null, // 提现金额
      payPassword: null, // 支付密码
      ratio: null, // 提现手续费
      showPasswordModal: false, //显示支付密码弹窗
      formUserType: -1,
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      withdrawRateText: '',
      tabList: [],
      tabIndex: -1,
      allBalance: '',
      userHeadImg: localStorage.getItem("userHeadImg"),
      userName: localStorage.getItem("userName"),
      isMallWx: false,
      showSubmitNamePopup: false, // 显示提交验证收款人姓名弹窗
      inputName: '', // 收款人姓名
      showInputError: false, // 未填写收款人姓名提示
      withdrawVersion: 2, // 2=企业转账 3=第二种-商家转账到零钱（旧） 4=第三种-商家转账到零钱（新）
      withdrawAmountLimit: 2, //默认最低提现金额为2元
      getApplymentConfig: true,
      enableChainModel: 0,
      isUseSelfMchId: false,
      isUseSelfMchIdm: false, //是否标准版平台商户申请二级商户
      showAddAliAccount: false,
      aliPayInfo: '',
      aliAccountEncry: '',
      version: 1,
      mchType: 1,
      showWithdrawMethod: false,
      invoiceList: [],
      showWithdrawRule: false,
      withdrawSettings: null,
      showFormula: false,
      pathFrom: '',
      tabTmp: -1,
    }
  },
  methods: {
    goInvoiceRule() {
      this.$routerGo(this, "push", { path: '/member/scholarship/invoiceRule' });
    },
    async tapUpload() {
     let fileList = await utilJs.chooseLocalFile({multiple:true, max:6});
     let invoiceListTmp = await utilJs.uploadImgListToOss(fileList, {showLoading: true});
     if (invoiceListTmp && invoiceListTmp.length) {
      this.invoiceList = [...this.invoiceList, ...invoiceListTmp].slice(0, 6)
     }
     console.log(this.invoiceList)
    },
    deleteInvoiceItem(invoiceIndex) {
      this.invoiceList.splice(invoiceIndex, 1);
    },
    getWithdrawSettings() {
      utilJs.getMethod(`${global.apiurl}common/getWithdrawSettings`, res => {
        this.withdrawSettings = res;
      })
    },
    closeDia() {
      this.showAddAliAccount = false;
    },
    popAliAccountModal() {
      this.showAddAliAccount = true;
    },
    addAliPaySuccess(aliData) {
      if (this.aliPayInfo) {
        this.aliPayInfo.alipayAccount = aliData.alipayAccount;
        this.aliPayInfo.alipayUserName = aliData.alipayUserName;
        this.aliPayInfo.mobile = aliData.mobile;
        this.aliAccountEncry = this.aliPayInfo.alipayAccount.substr(0, 3) + '****' + this.aliPayInfo.alipayAccount.substr(-2, 2);
      } else {
        this.aliPayInfo = {
          alipayAccount: aliData.alipayAccount,
          alipayUserName: aliData.alipayUserName,
          mobile: aliData.mobile
        }
        this.aliAccountEncry = this.aliPayInfo.alipayAccount.substr(0, 3) + '****' + this.aliPayInfo.alipayAccount.substr(-2, 2);
      }
      this.showAddAliAccount = false;
    },
    closeSubmitNamePopup() {
      this.inputName = '';
      this.showInputError = false;
      this.showSubmitNamePopup = false;
    },
    showReason() {
      this.$cjConfirm({
        title: '不可提现原因',
        message: '用户在苹果手机APP上充值的金额不可提现',
        showCancelButton: false,
        clickCloseModal: true
      })
    },
    inpurEnter() {
      if (this.inputName) {
        this.showInputError = false;
      }
    },
    //IOS微信6.7以上版本会导致输入法收起的时候，键盘没收起，需要手动滚下屏幕
    inputFocus() {
      if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
        inputScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
      }
    },
    inputBlur() {
      if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
        setTimeout(() => {
          document.body.scrollTop = inputScrollTop - 1 || 0;
        });
      }
    },
    changeWithdrawType(type) {
      // if (this.tabIndex == 1 && this.version > 1 && this.mchType == 100 && (type == 'SPREAD' || type == 'CHAIN')) {
      //   this.$showCjToast({
      //     text: "只支持微信提现",
      //     type: 'warn',
      //     time: 3000,
      //   })
      //   return
      // }
      // if (this.tabIndex == 2 && this.version > 1 && this.mchType == 2 && type == 'SPREAD') {
      //   this.$showCjToast({
      //     text: "只支持银行卡提现",
      //     type: 'warn',
      //     time: 3000,
      //   })
      //   return
      // }
      // if (this.tabIndex == 2 && type == 'SPREAD' && !this.getApplymentConfig)
      //   return;
      // if (this.tabIndex == 2 && type == 'CHAIN' && this.isUseSelfMchIdm)
      //   return;
      this.withdrawType = type;
      this.withdraw = null;
      this.resetTabindex();
    },
    checkSubmit() {
      if (this.tabIndex == -1) {
        this.$showCjToast({
          text: "请先选择提现方式",
          type: 'warn',
          time: 3000,
        })
        return false;
      } else if (this.tabIndex == 1 && this.noneBank) {
        this.$showCjToast({
          text: "请先绑定银行卡",
          type: 'warn',
          time: 3000,
        })
        return false;
      } else if (this.tabIndex == 3 && !this.aliAccountEncry) {
        this.$showCjToast({
          text: "请先绑定支付宝账号",
          type: 'warn',
          time: 3000,
        })
        return false;
      } else if (/\.\d{3}/.test(this.withdraw)) {
        this.$showCjToast({
          type: 'warn',
          text: '小数点后不应超过两位数字！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawType == 'SPREAD' && Number(this.userInfo.balance - this.userInfo.iosBalance) - Number(this.withdraw) < 0) {
        this.$showCjToast({
          type: 'warn',
          text: '余额不足哦！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.isMallWx && this.withdrawType == 'CHANNEL' && Number(this.userInfo.mallWxBalance) - Number(this.withdraw) < 0) {
        this.$showCjToast({
          type: 'warn',
          text: '视频号余额不足哦！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawType == 'DISTRIBUTION' && Number(this.userInfo.distributionBalance) - Number(this.withdraw) < 0) {
        this.$showCjToast({
          type: 'warn',
          text: '推广余额不足哦！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawType == 'SHAREHOLDER' && Number(this.userInfo.sBalance) - Number(this.withdraw) < 0) {
        this.$showCjToast({
          type: 'warn',
          text: '股东收益不足哦！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawType == 'CHAIN' && Number(this.userInfo.bonusBalance) - Number(this.withdraw) < 0) {
        this.$showCjToast({
          type: 'warn',
          text: '分红收益不足哦！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.formUserType == -1 && this.tabIndex == 1 && Number(this.withdraw) < 1) {
        this.$showCjToast({
          type: 'warn',
          text: '1元起提！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawType == 'SPREAD' && this.formUserType == -1 && this.tabIndex == 1 && Number(this.userInfo.balance) < 100 && (Number(this.withdraw) < Number(this.userInfo.balance))) {
        this.$showCjToast({
          type: 'warn',
          text: '余额少于100必须一次性提完！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.isMallWx && this.withdrawType == 'CHANNEL' && this.formUserType == -1 && this.tabIndex == 1 && Number(this.userInfo.mallWxBalance) < 100 && (Number(this.withdraw) < Number(this.userInfo.mallWxBalance))) {
        this.$showCjToast({
          type: 'warn',
          text: '视频号余额少于100必须一次性提完！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawType == 'DISTRIBUTION' && this.formUserType == -1 && this.tabIndex == 1 && Number(this.userInfo.distributionBalance) < 100 && (Number(this.withdraw) < Number(this.userInfo.distributionBalance))) {
        this.$showCjToast({
          type: 'warn',
          text: '推广余额少于100必须一次性提完！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawType == 'SHAREHOLDER' && this.formUserType == -1 && this.tabIndex == 1 && Number(this.userInfo.sBalance) < 100 && (Number(this.withdraw) < Number(this.userInfo.sBalance))) {
        this.$showCjToast({
          type: 'warn',
          text: '股东收益余额少于100必须一次性提完！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.formUserType == -1 && this.tabIndex == 1 && Number(this.withdraw) > 50000) {
        this.$showCjToast({
          type: 'warn',
          text: '提现金额不超过5万元！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.from == 'wechat' && Number(this.withdraw) < this.withdrawAmountLimit) {
        this.$showCjToast({
          type: 'warn',
          text: this.withdrawAmountLimit + '元起提！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if ((this.from == 'wechat' || this.from == 'aliPay') && Number(this.withdraw) > 5000) {
        this.$showCjToast({
          type: 'warn',
          text: '提现金额不超过5000元！',
          isShowMask: 'true'
        });
        this.withdraw = null;
        return false;
      } else if (this.withdrawSettings && this.withdrawSettings.isNeedInvoice == 2 && this.invoiceList.length == 0) {
        this.$showCjToast({
          type: 'warn',
          text: '请上传发票',
          isShowMask: 'true'
        });
        return false;
      } else if (this.tabIndex == 2 && Number(this.withdraw) >= 2000 && (this.withdrawVersion == 3 || this.withdrawVersion == 4) && !this.inputName) {
        // 提现到微信 && 提现金额大于等于2000 && 开通“商家转账到零钱” && 没有输入收款人姓名
        if (this.showSubmitNamePopup) {
          this.showInputError = true;
        } else {
          this.showSubmitNamePopup = true;
        }
        return false;
      } else {
        return true;
      }
    },
    clickSubmitName() {
      this.inputName = this.inputName.replace(/\s*/g, ""); // 去掉所有空格
      this.clickComfirm();
    },
    // 点击确定
    clickComfirm() {
      if (this.checkSubmit()) {
        this.payPassword = null;
        this.showInputError = false;
        this.showSubmitNamePopup = false;
        this.submit();
      }
    },

    hidePwd() {
      this.showPasswordModal = false;
    },
    confirmPwd(pwd) {
      this.payPassword = pwd;
      this.submit();
    },

    submit() {
      if (isClick || this.tabIndex == -1) {
        return;
      }
      isClick = true;
      // let that = this;
      let dest = this.tabIndex == 1 ? 1 : this.tabIndex == 2 ? 2 : 3;
      let postUrl = `${global.apiurl}members/widthdraw`
      if (this.formUserType != -1) {
        postUrl = `${global.apiurl}declares/widthdraw`
      }
      let postData = {
        userId: this.userInfo.userId,
        amount: this.withdraw,
        bankId: dest == 1 ? this.userBank.bankCardId : null,
        type: this.withdrawType == 'SPREAD' ? 1 : this.withdrawType == 'DISTRIBUTION' ? 2 : this.withdrawType == "SHAREHOLDER" ? 3 : this.withdrawType == "CHAIN" ? 5 : 4,
        dest: dest,
        password: this.payPassword
      };
      // 开通“商家转账到零钱”且金额超过2000需要实名验证
      if (this.tabIndex == 2 && Number(this.withdraw) >= 2000 && (this.withdrawVersion == 3 || this.withdrawVersion == 4) && !!this.inputName) {
        postData.userName = this.inputName;
      }
      if (this.withdrawSettings && ((this.withdrawSettings.isNeedInvoice == 1 && this.invoiceList.length > 0) || this.withdrawSettings.isNeedInvoice == 2)) {
        postData.invoiceList = this.invoiceList;
      }
      utilJs.postMethod(postUrl, postData, (res) => {
        isClick = false;
        this.showPasswordModal = false;
        // this.$showCjToast({
        //   type: 'success',
        //   text: '申请成功',
        //   isShowMask: 'true',
        //   onHide() {
        //     // that.$router.go(-1)
        //   }
        // });
        if (this.tabIndex == 2 && this.withdrawVersion == 4 && res.needWxConfirmReceipt == 1) { //needWxConfirmReceipt = 1 需要拉起微信提现
          this.receivePayment(res.wId);
        } else {
          this.$cjConfirm({
            title: '申请成功',
            message: this.tabIndex == 2 && this.withdrawVersion == 4 && res.needWxConfirmReceipt != 1 ? '商家审核通过后，您需确认收款才能到账' : '商家审核通过后到账',
            showCancelButton:false,
            confirmButtonText:'我知道了',
            onConfirm:() => {
            },
          })
          if (this.withdrawType == 'SPREAD') {
            this.userInfo.balance = this.userInfo.balance - this.withdraw;
          } else if (this.withdrawType == 'SHAREHOLDER') {
            this.userInfo.sBalance = this.userInfo.sBalance - this.withdraw;
          } else if (this.withdrawType == 'CHAIN') {
            this.userInfo.bonusBalance = this.userInfo.bonusBalance - this.withdraw;
          } else {
            this.userInfo.distributionBalance = this.userInfo.distributionBalance - this.withdraw;
          }
          this.withdraw = null; // 提现金额
          this.payPassword = null; // 支付密码
          this.invoiceList = [];
        }
      }, (failRes) => {
        isClick = false;
      });
    },
    receivePaymentCallBack() {
      this.$cjConfirm({
        title: '提现成功',
        message: '提现成功，请及时查收',
        showCancelButton:false,
        confirmButtonText:'我知道了',
        onConfirm:() => {
        },
      })
      if (this.withdrawType == 'SPREAD') {
        this.userInfo.balance = this.userInfo.balance - this.withdraw;
      } else if (this.withdrawType == 'SHAREHOLDER') {
        this.userInfo.sBalance = this.userInfo.sBalance - this.withdraw;
      } else if (this.withdrawType == 'CHAIN') {
        this.userInfo.bonusBalance = this.userInfo.bonusBalance - this.withdraw;
      } else {
        this.userInfo.distributionBalance = this.userInfo.distributionBalance - this.withdraw;
      }
      this.withdraw = null; // 提现金额
      this.payPassword = null; // 支付密码
    },
    receivePayment(wId) {
      this.$loading.show();
      utilJs.postMethod(global.apiurl + 'wxTransferBills/transferBills', { wId: wId }, res => {
        if (res.state == 'WAIT_USER_CONFIRM') {
          let transferData = {
            appId: res.appId,
            mchId: res.mchId,
            package: res.packageInfo
          }
          utilJs.wxReceivePayment(transferData, this.receivePaymentCallBack);
        }
        this.$loading.hide();
      });
    },
    // 全部提现
    totalWithdraw() {
      this.withdraw = this.withdrawType == 'SPREAD' ? this.userInfo.balance - this.userInfo.iosBalance : this.withdrawType == 'SHAREHOLDER' ? this.userInfo.sBalance : this.withdrawType == 'CHANNEL' ? this.userInfo.mallWxBalance : this.withdrawType == 'CHAIN' ? this.userInfo.bonusBalance : this.userInfo.distributionBalance;
    },
    goAddBank() {
      this.$routerGo(this, "push", { path: '/member/scholarship/bindBankcard' });
    },
    goSetPwd() {
      this.$routerGo(this, "push", { path: '/member/scholarship/updatePassword' });
    },
    getAliPayInfo() {
      utilJs.getMethod(`${global.apiurl}alipay/alipayAccountInfo`, res => {
        this.aliPayInfo = res;
        if (this.aliPayInfo && this.aliPayInfo.alipayAccount) {
          this.aliAccountEncry = this.aliPayInfo.alipayAccount.substr(0, 3) + '****' + this.aliPayInfo.alipayAccount.substr(-2, 2);
        }
      })
    },
    getUserBank() {
      let $this = this
      let postUrl = `${global.apiurl}members/widthdraw`
      if (this.formUserType != -1) {
        postUrl = `${global.apiurl}declares/widthdraw`
      }
      utilJs.postMethod(postUrl, {}, async function (res) {
        $this.isDistribution = JSON.parse(localStorage.getItem("companyAuth")).enableDistributionMarketModule;
        $this.userInfo = res.userInfo;
        $this.isMallWx = res.userInfo.isMallWx == 0 ? false : true;
        $this.version = res.version;
        $this.mchType = res.mchType;
        $this.withdrawVersion = res.withdrawVersion || 2;
        $this.enableChainModel = res.enableChainModel;
        $this.isUseSelfMchId = res.isUseSelfMchId;
        $this.isUseSelfMchIdm = res.isUseSelfMchId && res.version && Number(res.version) > 1;
        if (res.isWithdrawAmountLimit == 1) { //后台是否设置最低提现金额
          $this.withdrawAmountLimit = Number(res.withdrawAmountLimit);
        } else {
          $this.withdrawAmountLimit = 2;
        }
        //开通分销 && 分销余额大于0 && 未在公众号登录过
        if ($this.isDistribution && $this.userInfo.distributionBalance * 1 > 0 && !res.hasPmopenid) {
          const { distribution } = await utilJs.getLiveAuthData();
          let openUrl = `${distribution.domainUrl}/distributionPay.html?userId=${localStorage.getItem('userId')}`;
          utilJs.locationHref(openUrl);
        }
        $this.withdrawRateText = res.withdrawRateText || '';
        $this.nonePwd = false;
        $this.ratio = res.ratio;
        if ($this.from == 'wechat') {
          $this.noneBank = false;
          return;
        }
        enableWxWithdraw = res.enableWxWithdraw == 1 && res.mchType == 1; //一级商户才支持微信提现
        enableBankWithdraw = res.enableBankWithdraw == 1 && res.isUseSelfMchId == 1; //平台商户只支持支付宝提现
        enableAliPayWithdraw = res.enableAliPayWithdraw;
        if (res.userBank && res.userBank.account) {
          // 绑定了银行卡
          $this.noneBank = false;
          $this.userBank = res.userBank;
          $this.bankAccount = res.userBank.account.substr(-4, 4);
        } else {
          // 用户未绑定
          $this.noneBank = true;
        }
        // if ($this.formUserType != -1) {
        //   $this.allBalance = ($this.userInfo.balance * 1 + $this.userInfo.sBalance * 1).toFixed(2);
        // } else {
        //   $this.allBalance = ($this.userInfo.balance * 1 + $this.userInfo.distributionBalance * 1 + $this.userInfo.sBalance * 1 + ($this.isMallWx ? $this.userInfo.mallWxBalance * 1 : 0)).toFixed(2);
        // }
        $this.allBalance = ($this.userInfo.balance * 1 + $this.userInfo.distributionBalance * 1 + $this.userInfo.sBalance * 1 + ($this.isMallWx ? $this.userInfo.mallWxBalance * 1 : 0) + ($this.enableChainModel == 1 ? $this.userInfo.bonusBalance * 1 : 0)).toFixed(2);
        if (!($this.pathFrom && $this.pathFrom.includes('scholarship/bindBankcard'))) {
          $this.resetTabindex();
        }
      }, failRes => {
        this.$router.go(-1);
      })
    },
    changeType(index) {
      this.tabTmp = index;
      // this.tabIndex = index;
      // this.from = index == 1 ? 'bank' : index == 2 ? 'wechat' : 'aliPay';
      // if (this.tabIndex == 2 || this.tabIndex == 3) {
      //   if (!this.getApplymentConfig && this.userInfo.distributionBalance && Number(this.userInfo.distributionBalance) > 0) {
      //     this.withdrawType = 'DISTRIBUTION';
      //   } else {
      //     this.withdrawType = 'SPREAD';
      //   }
      // }
      // if (this.tabIndex == 2 && this.version > 1 && this.mchType == 2 && this.userInfo.distributionBalance && Number(this.userInfo.distributionBalance) > 0) {
      //   this.withdrawType = 'DISTRIBUTION';
      // }
      // if (this.tabIndex == 1 && this.version > 1 && this.mchType == 100) {
      //   if (this.isMallWx && this.userInfo.mallWxBalance && Number(this.userInfo.mallWxBalance) > 0) {
      //     this.withdrawType = 'CHANNEL';
      //   } else if (this.companyAuth.shareholderLevels > 0 && this.userInfo.sBalance && Number(this.userInfo.sBalance) > 0) {
      //     this.withdrawType = 'SHAREHOLDER';
      //   } else {
      //     this.withdrawType = '';
      //   }
      // }
    },
    //是否展示知识收入
    showSpreadType() {
      let withdrawTypeList = [];
      if (!this.isUseSelfMchId) { //平台商户只支持支付宝提现
        withdrawTypeList = [{title: '提现到支付宝', index: 3}]
      } else { //非平台商户根据后台设置
        if (enableAliPayWithdraw) {
          withdrawTypeList.push({title: '提现到支付宝', index: 3})
        }
        if (enableBankWithdraw) {
          withdrawTypeList.push({title: '提现到银行卡', index: 1})
        }
        if (enableWxWithdraw) {
          withdrawTypeList.push({title: '提现到微信', index: 2})
        }
      }
      return {
        isShow: true,
        withdrawTypeList: withdrawTypeList
      };
    },
    //是否视频号收入
    showChannelType() {
      let withdrawTypeList = [{title: '提现到银行卡', index: 1}];
      return {
        isShow: this.isMallWx && this.userInfo.mallWxBalance && Number(this.userInfo.mallWxBalance) > 0,
        withdrawTypeList: withdrawTypeList
      };
    },
    //是否展示推广收入
    showDistributionType() {
      let withdrawTypeList = [{title: '提现到支付宝', index: 3}];
      return {
        isShow: !this.isFaShou && this.userInfo.distributionBalance && Number(this.userInfo.distributionBalance) > 0,
        withdrawTypeList: withdrawTypeList
      };
    },
    //是否展示股东收益
    showShareholderType() {
      let withdrawTypeList = [];
      if (enableAliPayWithdraw) {
        withdrawTypeList.push({title: '提现到支付宝', index: 3})
      }
      if (enableBankWithdraw) {
        withdrawTypeList.push({title: '提现到银行卡', index: 1})
      }
      if (enableWxWithdraw) {
        withdrawTypeList.push({title: '提现到微信', index: 2})
      }
      return {
        isShow: this.companyAuth.shareholderLevels > 0 && this.userInfo.sBalance && Number(this.userInfo.sBalance) > 0,
        withdrawTypeList: withdrawTypeList
      };
    },
    //是否展示分红收益
    showChainType() {
      let withdrawTypeList = [];
      if (enableAliPayWithdraw) {
        withdrawTypeList.push({title: '提现到支付宝', index: 3})
      }
      if (enableBankWithdraw) {
        withdrawTypeList.push({title: '提现到银行卡', index: 1})
      }
      if (enableWxWithdraw) {
        withdrawTypeList.push({title: '提现到微信', index: 2})
      }
      return {
        isShow: this.enableChainModel == 1 && Number(this.userInfo.bonusBalance) > 0,
        withdrawTypeList: withdrawTypeList
      };
    },
    resetTabindex() {
      switch (this.withdrawType) {
        case 'SPREAD':
          this.tabList = this.showSpreadType().withdrawTypeList;
          break;
        case 'CHANNEL':
          this.tabList = this.showChannelType().withdrawTypeList;
          break;
        case 'DISTRIBUTION':
          this.tabList = this.showDistributionType().withdrawTypeList;
          break;
        case 'SHAREHOLDER':
          this.tabList = this.showShareholderType().withdrawTypeList;
          break;
        case 'CHAIN':
          this.tabList = this.showChainType().withdrawTypeList;
          break;
      }
      if (!this.tabList.length) {
        this.$showCjToast({
          text: "暂无提现方式",
          type: 'warn',
          time: 3000,
        })
        return
      }
      if (this.tabList.findIndex(element => element.index == 3) > -1) {
        this.tabIndex = 3;
      } else if (this.tabList.findIndex(element => element.index == 1) > -1) {
        this.tabIndex = 1;
      } else if (this.tabList.findIndex(element => element.index == 2) > -1) {
        this.tabIndex = 2;
      }
      this.tabTmp = this.tabIndex;
      this.from = this.tabIndex == 1 ? 'bank' : this.tabIndex == 2 ? 'wechat' : 'aliPay';
    },
    chooseWithdrawMethod() {
      this.tabTmp = this.tabIndex;
      this.showWithdrawMethod = true;
    },
    closeWithdrawMethod() {
      this.showWithdrawMethod = false;
    },
    confirmWithdrawMethod() {
      this.tabIndex = this.tabTmp;
      this.from = this.tabIndex == 1 ? 'bank' : this.tabIndex == 2 ? 'wechat' : 'aliPay';
      this.showWithdrawMethod = false;
    },
    //分享
    wechatShare: function () {
      utilJs.wechatConfig("", "", "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      utilJs.appShareTrue("", "", "", "");
    }
  },
  activated() {
    if (this.pathFrom && this.pathFrom.includes('scholarship/bindBankcard')) { //从添加银行卡页面返回，不刷新页面
      this.getUserBank()
      return;
    }
    utilJs.getMethod(`${global.apiurl}common/getApplymentConfig`, res => {
      this.getApplymentConfig = res.res;
      this.isPost = true;
      this.allBalance = '';
      this.withdrawType = this.$route.query.from == "shareholder" ? 'SHAREHOLDER' : 'SPREAD';
      this.from = this.$route.query.from == "shareholder" ? 'bank' : this.$route.query.from;
      this.withdraw = null;
      this.userInfo = {};
      this.userBank = '';
      this.formUserType = this.$route.query.formUserType || -1;
      let docTitle = this.formUserType != -1 ? '报单系统-提现' : '提现'
      this.tabIndex = -1; //this.from == "bank" ? 1 : this.from == "aliPay" ? 3 : 2;
      this.tabTmp = -1;
      this.tabList = [];
      this.showSubmitNamePopup = false;
      this.inputName = '';
      this.showInputError = false;
      this.withdrawVersion = 2;
      this.enableChainModel = 0;
      this.aliPayInfo = '';
      this.aliAccountEncry = '';
      this.showAddAliAccount = false;
      this.showWithdrawMethod = false;
      this.invoiceList = [];
      this.showWithdrawRule = false;
      this.showFormula = false;
      setDocumentTitle(docTitle);// eslint-disable-line
      this.getUserBank();
      this.getAliPayInfo();
      this.getWithdrawSettings();
      this.wechatShare();
    })
  },
  deactivated() {
    // this.withdraw = null; // 提现金额
    this.payPassword = null;
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
img {
  pointer-events: none;
}
.p-bmp8 {
  bottom: -0.02rem;
}
.p-rmp5 {
  right: -0.0125rem;
}
.submit-name-dialog {
  .weui-dialog {
    border-radius: 0.5rem;
  }
}
.modal-height {
  height: calc(100% - 1.7rem);
}
.bclose {
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
}
.bnum {
  right: 0.5rem;
  top: 2.3rem;
  z-index: 1;
}
.c-rotate45 {
  transform: rotate(45deg);
}
.img-item:not(:nth-child(3n)) {
  margin-right: calc((100% - 13.8rem) / 2);
}
.formula-list-bg {
  background: #ff5d3d33;
}
</style>
